#include <algorithm>
#include <iostream>
using namespace std;

const int kMaxN = 1e5 + 10;

int r[kMaxN];

bool Check(int n, int m) {
  for (int i = 0, j = n - m; i < m; i++, j++) {
    if (r[i] >= r[j]) {
      return false;
    }
  }
  return true;
}

int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> r[i];
  }
  sort(r, r + n);

  int ll = 0, rr = n;
  while (ll < rr) {
    int mm = (ll + rr) >> 1;

    if (Check(n, mm + 1)) {
      ll = mm + 1;
    } else {
      rr = mm;
    }
  }
  cout << n - ll << '\n';
  return 0;
}